package com.unism.base;
import java.util.HashMap;  

import org.junit.Test;  
import org.junit.runner.RunWith;  
import org.springframework.beans.factory.annotation.Autowired;  
import org.springframework.data.redis.core.RedisTemplate;  
import org.springframework.test.context.ContextConfiguration;  
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;  
  
@RunWith(SpringJUnit4ClassRunner.class)  
@ContextConfiguration(locations = { "classpath:/spring.xml" })  
public class hello {  
    @Autowired  
    private RedisTemplate<String, HashMap<String, String>> redisTemplate;  
  
    @Test  
    public void testSaveValue() {  
        String key = "myKey";  
        HashMap<String, String> value = new HashMap<String, String>();  
        value.put("Name", "XianBin");  
        redisTemplate.opsForValue().set(key, value);  
          
        Object obj = redisTemplate.opsForValue().get(key);  
          
        System.out.println("Object:" + obj.toString());  
    }  
}  